<template>
    <div >
      <el-button @click="btn">A的button</el-button>
      <!--A使用$attrs再传给B-->
      <B v-bind="$attrs" v-on="$listeners" h="h" ></B>
    </div>
</template>

<script>
  import B from "./B"
    export default {
      components:{
        B
      },
      name: "A",
      props:{
        name:{

        },
        age:{

        }
      },
      created() {
        console.log(this.age)
        console.log(this.name)
        console.log(this.$attrs)
        console.log(this.$listeners);
      },
      methods:{
        btn(){
          // console.log(this.$listeners)
          this.$emit("Aevent") // 子组件触发父组件的方法
        },
        Bevent(){
          console.log("Bevent")
        }
      }
    }
</script>

<style scoped>

</style>
